# -*- coding: utf-8 -*-
import os

from mon.baselib.utils import FileUtils

from src.handler.AbstractHandler import AbstractHandler


def copy_files(source_dir, dest_dir):
    app_path = os.path.join(source_dir, 'dist', 'mon.exe')
    FileUtils.copy_file(app_path, dest_dir)


class PushAutoOfficeHandler(AbstractHandler):

    def _setup_arg(self, subparsers):
        parser_s = subparsers.add_parser('auto', help='auto office sub help')
        parser_s.add_argument('--replace', '-r', type=bool, default=True, help='replace if file exist')
        parser_s.add_argument('--source', type=str, default='E:\\Maven\\My\\auto-office', help='source code dir path')
        parser_s.add_argument('--move', type=str, default='D:\\Software\\autooffice\\mon.exe', help='destination file path')
        parser_s.set_defaults(func=self.do_process)

    def _process(self, args):
        copy_files(args.source, args.move)
